package org.zsl.mybatis.app;

import org.apache.ibatis.session.SqlSession;
import org.zsl.mybatis.mapper.UserMapper;
import org.zsl.mybatis.model.User;
import org.zsl.mybatis.util.SqlSessionFactory;

import java.io.IOException;

public class Client5 {
    public static void main(String[] args) throws IOException {


        SqlSession session = SqlSessionFactory.getSqlSession();

        UserMapper mapper=  session.getMapper(UserMapper.class);

       User user= mapper.selectById(1);

        System.out.println(user.getUsername());
        System.out.println(user.getRole().getRoleName());

        session.close();

    }
}
